function EndAssistant(){
	
}

EndAssistant.prototype.setup = function(){
	/*this.buttonAttributes = {};
	this.buttonModel = { 
		buttonLabel : 'Finish', 
		buttonClass : 'palm-button affirmative buttonfloat',
		disabled : false
		};

	this.controller.setupWidget("gameFinish", this.buttonAttributes, this.buttonModel);
	Mojo.Event.listen(this.controller.get('gameFinish'), Mojo.Event.tap, this.finishButton.bind(this));*/
	this.CommandMenuAttributes = {
										spacerHeight: 25,
										menuClass: 'no-fade',
									 };
		
		this.CommandMenuModel = {
									visible: true,
									items: [{}, {
									  		items: [{
													label: 'Finish',
													command: 'finish'
												},/*{
													label: 'Submit Score',
													command: 'submit'
												},{
													label: 'Store',
													command: 'store'
												}*/]
											}, {}
											]
								};
	this.controller.setupWidget(Mojo.Menu.commandMenu, this.CommandMenuAttributes, this.CommandMenuModel);
}

EndAssistant.prototype.activate = function(event) {
	/* put in event handlers here that should only be in effect when this scene is active. For
	   example, key handlers that are observing the document */
	   var bonus;
	   var startMoney;
	   switch (difficultySettings){
		case "easy":
		   	bonus = 0;
			startMoney = 7.50;
			break;
		case "medium":
			bonus = 1.50;
			startMoney = 5.00;
			break;
		case "hard":
			bonus = 2.50;
			startMoney = 3.00;
			break;
	   }
	   var average = (money - startMoney) / numberOfDays;
	   average = (Math.floor(average * 100)) / 100;
	   var finalScore = average + bonus;
	   $(dayDisplay).innerHTML = numberOfDays + " Days";
	   $(difficultyDisplay).innerHTML = difficultySettings;
	   $(endMoney).innerHTML = money;
	   $(averageDisplay).innerHTML = average;
	   $(bonusDisplay).innerHTML =bonus;
	   $(finalScoreDisplay).innerHTML = finalScore + " made per day";
	   
}
EndAssistant.prototype.finishButton = function (event){
	var startMoney;
	 switch (difficultySettings){
		case "easy":
		   	//bonus = 0;
			startMoney = 7.50;
			break;
		case "medium":
			//bonus = 1.50;
			startMoney = 5.00;
			break;
		case "hard":
			//bonus = 2.50;
			startMoney = 3.00;
			break;
	   }
	 dayNumber = 1;
	// numberOfDays = 10;
	 pricePerSuger = 5;
	 pricePerLemon = 6;
	 numberOfLemons = 1;
	 numberOfSuger = 1;
	 numberOfCups = 1;
	 numberOfAds = 1;
	 priceOfAds = 0.15;
	 price = 0.01;
	 pricePerCup = 0;
	 money = startMoney;
	 expenses = 0;
	 chanceOfRain = 0;
	 temperature = 0;
	 messageTrue = false;
	 sugerMessage = "";
	 sugerGood = false;
	 cupsSoldNumber = 0;
	// difficultySettings = "medium";
	// daysSettings = 10;
	Mojo.Controller.stageController.swapScene('start');
}

EndAssistant.prototype.submit = function(event){
	Mojo.Controller.stageController.swapScene('globalHigh');
}

EndAssistant.prototype.deactivate = function(event) {
	/* remove any event handlers you added in activate and do any other cleanup that should happen before
	   this scene is popped or another scene is pushed on top */
}

EndAssistant.prototype.handleCommand = function (event) {
	this.controller=Mojo.Controller.stageController.activeScene();
    if (event.type == Mojo.Event.commandEnable &&
	    (event.command == Mojo.Menu.helpCmd)) {
         event.stopPropagation(); // enable help. now we have to handle it
    }
	 if (event.type == Mojo.Event.commandEnable &&
	    (event.command == Mojo.Menu.prefsCmd)) {
         event.stopPropagation(); // enable help. now we have to handle it
    }

	console.log("RIGHT HERE");
	if (event.type == Mojo.Event.command) {
		var youOrdered = "";
		console.log("SettingsSceneAssistant::handleCommand(): Got command: " + event.command);
		switch (event.command) {
			
			// another built-in menu item, but we've enabled it (see below in this method)
			// so now we have to handle it:
			case Mojo.Menu.helpCmd:
				Mojo.Controller.stageController.pushScene('support');
				break;
				
			case Mojo.Menu.prefsCmd:
				Mojo.Controller.stageController.pushScene('settings');
				break;
			case "finish":
				this.finishButton();
				break;
			case "submit":
				this.submit();
				break;
			case "Store":
				this.store();
				
		}
	}	
}

EndAssistant.prototype.cleanup = function(event) {
	/* this function should do any cleanup needed before the scene is destroyed as 
	   a result of being popped off the scene stack */
}